1. Field of the Invention
The present invention relates generally to a data processing system. In particular, the present invention relates to a Java™ runtime environment in a data processing system. Still more particularly, the present invention relates to optimizing a classpath environment variable in the Java™ runtime environment by generating a new classpath environment variable that only includes directories containing classes that are required by a current Java™ program.
2. Description of the Related Art
In the Java™ runtime environment, when a user invokes a Java™ program, the Java™ class loader loads bootstrap classes, extension classes, and user classes. Java™ runtime environment (JRE) is a product available from Sun Microsystems, Inc. Bootstrap classes are classes of the basic Java™ platform. Extension classes are Java™ archive (JAR) files that are required by the Java™ platform. User classes are classes that are defined by program developers. Currently, the location of the user classes is identified by the classpath environment variable, which lists directories and JAR files containing class files. The classpath environment variable is typically set on a user login to be used for all of the Java™ programs.
When Java™ programs are installed, Java™ class loader loads packages containing classes that are required by the Java™ program by traversing the classpath environment variable as defined by the user. In this way, the required classes may be identified by the Java™ class loader. However, as the number of directories or JAR files defined in the classpath environment variable increases or as the number of Java™ programs increases, searching through the classpath environment variable becomes very time consuming. The number of classes or JAR files in a directory also is a factor. Thus, the number of classes, directories, and JAR files may increase as additional Java™ programs are installed.
Furthermore, some Java™ programs may be executed repeatedly with different input data. These programs include programs that process a file of credit card transactions, cumulative rainfall amounts, seismic data, images, or other types of information. These repeatedly executed programs are either time sensitive or run on resources that are constrained by usage or time. If all directories and JAR files in the classpath environment variable are searched each time one of these programs is executed, performance of the program may suffer.
Since the required classes must be loaded before the Java™ program can be executed, it would be advantageous to have the classpath environment variable that only contain relevant classes for the current Java™ program, such that the time spent searching for the required classes in the classpath environment variable may be minimized.